package org.webscale.util.sqs;
import org.apache.log4j.Logger;
import org.webscale.ApplicationException;

import com.xerox.amazonws.sqs2.Message;
import com.xerox.amazonws.sqs2.MessageQueue;
import com.xerox.amazonws.sqs2.SQSException;

public class SQSMessageHandlerDummy implements SQSMessageHandler {

private static final Logger log = Logger.getLogger(SQSMessageHandlerDummy.class);

	public void onMessage(Message msg ,  MessageQueue queue) {
		String message = msg.getMessageBody();
		String id= msg.getMessageId();
		log.info("-------------------------------------------");
	    log.info("Message Received - " + message + " id = " + id + "\n");
		try {
			queue.deleteMessage(msg);
 		 log.info("Remaining message in queue " + queue.getApproximateNumberOfMessages());
		} catch (SQSException e) {
			log.error("error deleting message from queue", e);
			throw new ApplicationException(e);
		}
		
	}

}
